﻿@using Snow.Template.Authorization.MenuItems.Dto
@model Snow.Template.Web.Models.MenuItems.CreateOrEditMenuItemModalViewModel
<link href="~/lib/select2/dist/css/select2.css" rel="stylesheet" asp-append-version="true" />
<form id="modelForm" name="MenuItemInformationsForm" role="form" novalidate>
    @if (Model.IsEditMode)
    {
        <input type="hidden" name="Id" value="@Model.MenuItem.Id" />
        @*<input type="hidden" name="Id" value="@Model.MenuItem.Id" />*@
    }
    <input asp-for="MenuItem.ParentId" type="hidden" />
    <div class="form-group">
        <label asp-for="MenuItem.Name"></label>
        <input asp-for="MenuItem.Name" type="text" class="form-control" placeholder="@Html.DisplayNameFor(model => model.MenuItem.Name)">
        <span asp-validation-for="MenuItem.Name" class="text-danger"></span>
    </div>
    <div class="form-group">
        <label asp-for="MenuItem.Icon"></label>
        <input asp-for="MenuItem.Icon" type="text" class="form-control" placeholder="@Html.DisplayNameFor(model => model.MenuItem.Icon)">
        <span asp-validation-for="MenuItem.Icon" class="text-danger"></span>
    </div>
    <div class="form-group">
        <label asp-for="MenuItem.PermissionName"></label>
        <input asp-for="MenuItem.PermissionName" type="text" class="form-control" placeholder="@Html.DisplayNameFor(model => model.MenuItem.PermissionName)">
        <span asp-validation-for="MenuItem.PermissionName" class="text-danger"></span>
    </div>
    @*<div class="form-group">
            <label asp-for="MenuItem.ParentId"></label>
            <select id="parentMenu" name="MenuItem.ParentId" class="form-control">
                <option></option>
                @foreach (MenuItemSelectListDto menu in Model.MenuItems)
                {
                    if (menu.IsSelected)
                    {
                        <option value="@menu.Id" selected="selected">@menu.Name</option>

                    }
                    else
                    {
                        <option value="@menu.Id">@menu.Name</option>
                    }
                }
            </select>
            <span asp-validation-for="MenuItem.ParentId" class="text-danger"></span>
        </div>*@
    <div class="form-group">
        <label asp-for="MenuItem.Route"></label>
        <input asp-for="MenuItem.Route" type="text" class="form-control" placeholder="@Html.DisplayNameFor(model => model.MenuItem.Route)">
        <span asp-validation-for="MenuItem.Route" class="text-danger"></span>
    </div>
    <div class="form-group">
        <label asp-for="MenuItem.Sort"></label>
        <input asp-for="MenuItem.Sort" type="number" class="form-control" placeholder="@Html.DisplayNameFor(model => model.MenuItem.Sort)">
        <span asp-validation-for="MenuItem.Sort" class="text-danger"></span>
    </div>
</form>
<script src="~/lib/select2/dist/js/select2.js" asp-append-version="true"></script>
<script src="~/view-resources/Views/MenuItems/_CreateOrEditModal.js" asp-append-version="true"></script>
<script type="text/javascript">
    $.validator.unobtrusive.parse('form');
</script>